namespace Billing2
{
    using System;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;

    public class Logout : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Common.AuditLog("logout");

            this.Session["SiteID"] = null;
            this.Session.Clear();
            this.Session.Abandon();

            HttpCookie cookie = new HttpCookie("ASP.NET_SessionId", "");
            cookie.Secure = true;
            cookie.HttpOnly = true;
            Response.Cookies.Add(cookie);
            Response.Redirect("default.aspx", true);

            //FormsAuthentication.SignOut();
            //HttpContext.Current.Session.Abandon();

            //Response.Clear();
            //Response.Buffer = true;
            //Response.Expires = 0;
            //Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
            //Response.AddHeader("pragma", "no-cache, no-store");
            //Response.AddHeader("cache-control", "private");
            //Response.CacheControl = "no-cache, no-store";
            //Response.Redirect("default.aspx", true);
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            ViewStateUserKey = Session.SessionID;
        }
    }
}
